﻿@{ Layout = "~/Views/Shared/_ModalForm.cshtml";
}


<div class="wrapper animated fadeInRight">
    <form id="form" class="form-horizontal m">
        <input id="id" col="Id" class="hide" />
        <div class="form-group">
            <div class="col-sm-12">
                <textarea id="value" col="Value" class="form-control" style="height:700px"></textarea>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    var id = ys.request("id");
    var act = 'editValue';

    $(function () {
        getForm();
        $("#form").validate({
            rules: {
            }
        });
    });

    function getForm() {
        ys.ajax({
                url: '@Url.Content("~/Sys/ConfigItem/GetEditDtoJson")' + '?id=' + id,
                type: "get",
                success: function (rst) {
                    if (rst.Flag == 1) {
                        $("#form").setWebControls(rst.Data);
                    }
                    else ys.msgError(rst.Message);
                }
            });
    }

    function saveForm(index) {
        if (!ys.checkTextLenth("value", "值", 0, 5139)) return;
        if ($("#form").validate().form()) {

            var postData = $("#form").getWebControls({ Id: id });
            postData.Value = $("#value").val();
            ys.ajax({
                url: '@Url.Content("~/Sys/ConfigItem/")' + act,
                type: "post",
                data: postData,
                success: function (rst) {
                    if (rst.Flag == 1) {
                        ys.msgSuccess(rst.Message);
                    }
                    else {
                        ys.msgError(rst.Message);
                    }
                }
            });
        }
    }

</script>
